/**
 * Created with JetBrains WebStorm.
 * User: Administrator
 * Date: 13-6-6
 * Time: 下午1:20
 * To change this template use File | Settings | File Templates.
 */


Ext.define('cloud.view.articlecategory.ArticleCategoryAdd', {
    extend: 'Ext.form.FormPanel',
    xtype: 'articlecategoryadd',
    config: {
        title: '添加资讯分类',
        items: [
            {
                xtype: 'toolbar',
                docked: 'bottom',
                layout: {
                    type: 'hbox',
                    pack: 'end'
                },
                items: [
                    {
                        id: 'articlecategory_submit',
                        iconMask: true,
                        scope: this,
                        cls: 'x-button2',
                        text: '提交',
                        cls: 'x-button2',
                        style: 'float:right'
                    }
                ]
            },
            {
                xtype: 'fieldset',


                defaults: {
                    labelwidth: '20%',
                    xtype: 'textfield',
                    required: true,
                    clearIcon: true
                },
                items: [
                    {
                        xtype: 'selectfield',
                        store: 'AreaAllFindStore',
                        id: 'article_cadid',
                        name: 'cadid',
                        label: '选择开通地区',
                        displayField: 'name',
                        valueField: 'cadid',
                        listeners: {
                            initialize: function () {
                                var caid = localStorage.getItem('caid');
                                var store = Ext.getStore('AreaAllFindStore');
                                store.filter('status', 1, true);
                                store.load({params: {caid: caid}});
                            }
                        }
                    },

                    {
                        id: 'article_name',
                        name: 'name',
                        label: '分类名',
                        maxLength: 50,
                        placeHolder: '请输分类名'
                    },
                    {   xtype: 'selectfield',
                        id: 'article_display',
                        name: 'display',
                        label: '请选择排序',
                        options: [
                            {text: '1', value: '1'},
                            {text: '2', value: '2'},
                            {text: '3', value: '3'},
                            {text: '4', value: '4'},
                            {text: '5', value: '5'},
                            {text: '6', value: '6'},
                            {text: '7', value: '7'},
                            {text: '8', value: '8'},
                            {text: '9', value: '9'},
                            {text: '10', value: '10'}
                        ]
                    },
                    {
                        xtype: 'panel',
                        layout: 'hbox',
                        items: [
                            {
                                xtype: 'label',
                                style:'width:30%;',
                                cls:'x-form-label',
                                html: '<span>分类图片</span>'
                            },
                            {
                                xtype: 'panel',
                                layout: 'vbox',
                                items: [
                                    {
                                        id: 'artic_upload',
                                        style: 'margin:10px',
                                        html: '<input id="articlecategory_img"  type="file" onchange="previewImage(this)"  />'
                                    },
                                    {
                                        id: 'artic_showImage',
                                        style: 'margin:10px',
                                        html: '<div id="preview"><img id="imghead" width=150 height=150 src=""></div>'
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        ]
    }
});